/**
 * 问题列表
 * 可在需要的页面使用this.$store.state.questionList.questionList获取
 * [{
				//提出问题的用户的信息
				questionUserInfo: {
					userId: 2,
					userName: "aJW",
					sex: "man",
					imagePath: "https://img11.360buyimg.com/n7/jfs/t1/94448/29/2734/524808/5dd4cc16E990dfb6b/59c256f85a8c3757.jpg"
				},
				//问题信息
				questionInfo: {
					id: "1",
					questionTitle: "微积分怎么求?微积分怎么求?微积分怎么求?微积分怎么求?微积分怎么求?微积分怎么求?微积分怎么求?",
					date: "2020-05-15",
					describe: "瓶身描绘的牡丹一如你初妆，冉冉檀香透过窗心事我了然，宣纸上走笔至此搁一半描绘的牡丹一如你初妆，冉冉檀香透过窗心事我了然，宣纸上走笔至此",
					imagePath: "https://img11.360buyimg.com/n7/jfs/t1/94448/29/2734/524808/5dd4cc16E990dfb6b/59c256f85a8c3757.jpg",
					commentCount: 30,
					isLike: false,
					likeNum: 2
				}
			},
			{
				//提出问题的用户的信息
				questionUserInfo: {
					userId: 3,
					userName: "bJW",
					sex: "man",
					imagePath: "https://img11.360buyimg.com/n7/jfs/t1/94448/29/2734/524808/5dd4cc16E990dfb6b/59c256f85a8c3757.jpg"
				},
				//问题信息
				questionInfo: {
					id: "2",
					questionTitle: "微积分怎么求?微积分怎么求?微积分怎么求?微积分怎么求?微积分怎么求?微积分怎么求?微积分怎么求?",
					date: "2020-05-15",
					describe: "瓶身描绘的牡丹一如你初妆，冉冉檀香透过窗心事我了然，宣纸上走笔至此搁一半描绘的牡丹一如你初妆，冉冉檀香透过窗心事我了然，宣纸上走笔至此",
					imagePath: "https://img11.360buyimg.com/n7/jfs/t1/94448/29/2734/524808/5dd4cc16E990dfb6b/59c256f85a8c3757.jpg",
					commentCount: 30,
					isLike: false,
					likeNum: 2
				}
			}, {
				//提出问题的用户的信息
				questionUserInfo: {
					userId: 4,
					userName: "cJW",
					sex: "man",
					imagePath: "https://img11.360buyimg.com/n7/jfs/t1/94448/29/2734/524808/5dd4cc16E990dfb6b/59c256f85a8c3757.jpg"
				},
				//问题信息
				questionInfo: {
					id: "3",
					questionTitle: "微积分怎么求?微积分怎么求?微积分怎么求?微积分怎么求?微积分怎么求?微积分怎么求?微积分怎么求?",
					date: "2020-05-15",
					describe: "瓶身描绘的牡丹一如你初妆，冉冉檀香透过窗心事我了然，宣纸上走笔至此搁一半描绘的牡丹一如你初妆，冉冉檀香透过窗心事我了然，宣纸上走笔至此",
					imagePath: "https://img11.360buyimg.com/n7/jfs/t1/94448/29/2734/524808/5dd4cc16E990dfb6b/59c256f85a8c3757.jpg",
					commentCount: 30,
					isLike: false,
					likeNum: 2
				}
			},
			{
				//提出问题的用户的信息
				questionUserInfo: {
					userId: 5,
					userName: "dJW",
					sex: "man",
					imagePath: "https://img11.360buyimg.com/n7/jfs/t1/94448/29/2734/524808/5dd4cc16E990dfb6b/59c256f85a8c3757.jpg"
				},
				//问题信息
				questionInfo: {
					id: "4",
					questionTitle: "微积分怎么求?微积分怎么求?微积分怎么求?微积分怎么求?微积分怎么求?微积分怎么求?微积分怎么求?",
					date: "2020-05-15",
					describe: "瓶身描绘的牡丹一如你初妆，冉冉檀香透过窗心事我了然，宣纸上走笔至此搁一半描绘的牡丹一如你初妆，冉冉檀香透过窗心事我了然，宣纸上走笔至此",
					imagePath: "https://img11.360buyimg.com/n7/jfs/t1/94448/29/2734/524808/5dd4cc16E990dfb6b/59c256f85a8c3757.jpg",
					commentCount: 30,
					isLike: false,
					likeNum: 2
				}
			},
			{
				//提出问题的用户的信息
				questionUserInfo: {
					userId: 6,
					userName: "eJW",
					sex: "man",
					imagePath: "https://img11.360buyimg.com/n7/jfs/t1/94448/29/2734/524808/5dd4cc16E990dfb6b/59c256f85a8c3757.jpg"
				},
				//问题信息
				questionInfo: {
					id: "5",
					questionTitle: "微积分怎么求?微积分怎么求?微积分怎么求?微积分怎么求?微积分怎么求?微积分怎么求?微积分怎么求?",
					date: "2020-05-15",
					describe: "瓶身描绘的牡丹一如你初妆，冉冉檀香透过窗心事我了然，宣纸上走笔至此搁一半描绘的牡丹一如你初妆，冉冉檀香透过窗心事我了然，宣纸上走笔至此",
					imagePath: "https://img11.360buyimg.com/n7/jfs/t1/94448/29/2734/524808/5dd4cc16E990dfb6b/59c256f85a8c3757.jpg",
					commentCount: 30,
					isLike: false,
					likeNum: 2
				}
			}
		]
 */
export default{
	state:{
		//问题列表
		questionList: ""
	},
	mutations: {
		//改变点赞状态
		changeIsLike(state,index){
			state.questionList[index].islike = !state.questionList[index].islike;
		},
		//改变点赞数
		changeLikeNum(state,likeNum,index){
			for (var i = 0; i < state.questionList.length; i++) {
				if(index == i){
					state.questionList[i].likenum = likeNum;
				}
			}
			
		},
		//修改questionList
		setQuestionList(state,questionList){
			state.questionList = questionList;
		}
	},
	actions:{
		getQuestionList({commit},majorId){
		    uni.request({
		    	url: 'https://www.tosjw.cn/tsg/questioninfo/getQuestionList',
				data:{
					majorId: majorId
				},
		    	success:(res)=>  {
					commit('setQuestionList',res.data.data);
		    	},
		    	fail:()=>  {
		    		console.log("获取问题列表失败");
		    	}
		    })  
		}
	},
	getters:{
		questionList(state){
		    return state.questionList;
		}
	}
}